package junyi.classic.actions;

import junyi.classic.player.ClassicPlayer;
import junyi.classic.player.playerProperties.ReadyForAttack;
import junyi.player.Player;
import junyi.player.PlayerProperty;
import junyi.power.Action;
import junyi.power.effects.EffectSource;
import junyi.power.effects.PropertyChange;

/**
 * User: Junyi BEI
 * Date: 04/10/2012
 * Time: 06:06
 */
public class FinishAttack extends Action {

  private ClassicPlayer player;
  private int expected;
  
  
  public FinishAttack(ClassicPlayer p, int e, EffectSource es) {
    super(es);
    player = p;
    expected = e;
  }

  @Override
  public int start(int c) {
    if(c != expected) {
      return ACTION_FAILURE;
    }
    PropertyChange propertyChange = new PropertyChange(player, ReadyForAttack.class, false, effectSource);
    return propertyChange.start();
  }
}
